home *** CD-ROM | disk | FTP | other *** search
/ ftp.mactech.com 2010 / ftp.mactech.com.tar / ftp.mactech.com / util / Mac F2C 1.3.sit / Mac F2C 1.3 / Mac F2C v1.3 Documentation.rsrc / TEXT_133.txt < prev    next >
Text File  |  1995-12-11  |  4KB  |  58 lines

  1. Using Mac F2C Generated Code
  2.  
  3.  
  4. The C/C++ code produced by Mac F2C has special compile and link requirements.  These are discussed in detail in the chapters focused on using Mac F2C with specific compilers.  However, the general requirements are easily stated (some of these requirements can be relaxed; refer to the compiler-specific chapters):
  5.  
  6. Compile Requirements
  7. ‚Ä¢ Most of these only apply to 68K code generation
  8. ‚Ä¢ 4-byte integers
  9. ‚Ä¢ 8-byte doubles
  10. ‚Ä¢ far code
  11. ‚Ä¢ far data
  12.  
  13. Link Requirements
  14. ‚Ä¢ All libraries must be chosen compatible with above compiler settings
  15. ‚Ä¢ ANSI libraries
  16. ‚Ä¢ Math libraries (if not included in the ANSI libraries)
  17. ‚Ä¢ Console libraries (for a minimal Macintosh interface)
  18. ‚Ä¢ C++ support libraries (for C++ code only)
  19. ‚Ä¢ Mac F2C support libraries (libI77 and libF77)
  20. ‚Ä¢ F2Cmain.c or F2Cmain.cp
  21.  
  22.  
  23. The easiest way to use Mac F2C generated code is to create a new project file using one of the Mac F2C project models or stationary (depending on your environment).  Then add the code files generated by Mac F2C to the project and bring everything up-to-date.  You are ready to run:  that‚Äôs all there is to it!  
  24.  
  25. Use the ‚ÄúC‚Äù versions of project stationary to work with C code generated by Mac F2C and the ‚ÄúC++‚Äù versions of project stationary to work with C++ code generated by Mac F2C.
  26.  
  27. The enclosed AT&T Computing Science Technical Report No. 149 is your compiler and language reference manual.  I encourage you to read it.  You can print this report by downloading it to any PostScript printer.  You can use Apple‚Äôs LaserWriter Utility application to do this or you can use any of the many equivalent utilities.  
  28.  
  29.  
  30. Making Mac F2C-generated Code Multitask
  31.  
  32. Functions have been built into the support library libI77 that allow you to make code generated by Mac F2C multitask under the MacOS cooperative multitasking environment.
  33.  
  34. Using Symantec, THINK or Metrowerks:
  35.  
  36. Cooperative multitasking does not happen automatically.  To make FORTRAN code multitask cooperatively, you need to insert calls such as the following into your FORTRAN source code:
  37.  
  38.     CALL DOMULTITASK(N)
  39.  
  40. where N is the number of ticks (60ths of a second) that you are willing to let your program sleep while other programs execute.  
  41.  
  42. If you prefer, you can instead insert the following function calls in the C/C++ code generated by Mac F2C:
  43.  
  44.     DoMultiTask( N );
  45.  
  46. where N is as above.  You can mix and match the two methods if you wish.  However, note that if you modify the generated C code, your modifications will be destroyed if you re-translate the FORTRAN code. 
  47.  
  48. Using MPW:
  49.  
  50. MPW tools created with the F2C for MPW libraries provide cooperative multitasking for your tools.  This has been coupled with the I/O of the library.  You will notice that while your program is performing io the cursor will be a spinning beach ball.  This allows other programs to have some of the CPU and allows your tool to be put in the background.  If you have some computationally intensive code that does not perform I/O you can call the MPW SpinCursor routine explicitly to free up the CPU for other programs.  The documentation for this routine is provided with MPW.  To call it from FORTRAN use the something like this:
  51.  
  52.     CALL SPINCURSOR(N)
  53.  
  54. where N is the increment to an internal counter (see the MPW SpinCursor doucmentation).  You can simply use 1.  You can also use the same subroutine call as for Symantec, THINK, and CodeWarrior, namely:
  55.  
  56.     CALL DOMULTITASK(N)
  57.  
  58. In the MPW case, the call to DOMULTITASK will simply call through to SPINCURSOR.  However, under MPW, N is interpreted as an increment to the internal counter (instead of as the number of ticks your application is willing to sleep).